<script>
	import { AuthService } from './utils/auth.js'
	
	export default {
		onLaunch: function() {
			console.log('App Launch')
			this.checkAuthenticationState()
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},
		methods: {
		/**
		 * Check authentication state on app launch
		 * 不再强制要求登录，让用户可以自由浏览应用
		 */
		checkAuthenticationState() {
			try {
				// Check if user has a stored authentication token
				const token = AuthService.getToken()
				const userInfo = AuthService.getUserInfo()
				
				console.log('Checking authentication state:', { 
					hasToken: !!token, 
					hasUserInfo: !!userInfo 
				})
				
				// 无论用户是否已登录，都允许访问应用首页
				// 登录检查将在访问"我的"页面时进行
				console.log('App launched, user can browse freely')
			} catch (error) {
				console.error('Error checking authentication state:', error)
			}
		}
		}
	}
</script>

<style>
	/*每个页面公共css */
</style>
